<script lang="ts" setup>
// typescript
interface IProps {
  /**
   * 是否禁用
   */
  disabled?: boolean
}
const props = withDefaults(defineProps<IProps>(), {
  disabled: false
});
</script>

<!-- 优惠券卡片 -->
<template>
  <view class="w-components-container w-coupon-item" :class="{ disabled }">
    <view class="info-view">
      <view class="ellipsis-2">数码产品专用 20元优惠券</view>
      <view>有效截止日期：2022-11-11</view>
    </view>
    <view class="button-view">
      <view class="amount">
        <text>￥</text>
        <text>20</text>
      </view>
      <!-- <view>
        <button class="custom-button">立即使用</button>
      </view> -->
    </view>
  </view>
</template>

<style scoped lang="scss">
// scss
.w-coupon-item {
  height: 160rpx;
  display: flex;

  &.disabled {
    .button-view, .info-view {
      background-color: #CCCCCC;
    }
  }
}

.info-view {
  background-color: #fff;
  border-radius: 4px;
  flex: 1;
  padding: 20rpx;
  font-size: 28rpx;
  display: flex;
  flex-direction: column;
  color: $text-color;
  border-right: 1px dashed #fff;

  > view {
    &:first-child {
      flex: 1;
    }

    &:last-child {
      font-size: 24rpx;
      color: #999;
    }
  }
}

.button-view {
  border-radius: 4px;
  width: 160rpx;
  height: 160rpx;
  background-color: #FF2121;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  .amount {
    font-size: 80rpx;

    text {
      &:nth-child(1) {
        font-size: 24rpx;
      }
    }
  }

  .custom-button {
    width: 140rpx;
    height: 40rpx;
    font-size: 24rpx;
    text-align: center;
    margin-top: 10rpx;
  }
}
</style>